<template>
  <div
    class="my-header"
    :style="{ backgroundColor: backgroundColor, color: color }"
  >
    {{ title }}
  </div>
</template>

<script>
export default {
  // props:["title","backgroundColor","color"]
  props: {
    title: String, //检验外面传入值的类型(日过外面给title变量传的不是字符串，报错)
    backgroundColor: {
      type: String,
      required: true, //要求变量必须传入一个值
    },
    color: {
      type: String,
      default: "fff", //外面不给color变量赋值，color值默认白色
    },
  },
};
</script>

<style lang="less" scoped>
.my-header {
  height: 45px;
  line-height: 45px;
  text-align: center;
  background-color: #ff1d1d;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  margin-bottom: 15px;
}
</style>